//
//  CMDBMovieStaffGroupCell.swift
//  CMDB
//
//  Created by 曹桂祥 on 2017/5/9.
//  Copyright © 2017年 CMDB. All rights reserved.
//

import UIKit

private let KMovieWidth : CGFloat = (CMDB_Screen_Width - (KleftMargin + 12) * 5) / 4

class CMDBMovieStaffGroupCell: CustomBaseCell {
    
    var titleLabel : UILabel!
    
    var testBackView : UIView!
    
    var staffCollectionView : CMDBMovieStaffCollectionView!
    
    override func setupCell() {
        super.setupCell()
        
        backgroundColor = UIColor.whiteColor()
        
    }
    
    override func cellBuildSubViews() {
        super.cellBuildSubViews()
        
        titleLabel = UILabel.getInstance()
        
        titleLabel.text = "导演组"
        
        titleLabel.frame = CGRect(x: 0, y: 0, width: CMDB_Screen_Width, height: 44)
        
        titleLabel.textAlignment = .Center
        
        titleLabel.backgroundColor = singleViewColor
        
        contentView.addSubview(titleLabel)
        
        testBackView = UIView.getInstance()
        
        testBackView.frame = CGRect(x: 0, y: 44, width: CMDB_Screen_Width, height: 44)
        
        testBackView.backgroundColor = UIColor.randomColor()
        
        contentView.addSubview(testBackView)
        
        setupCollectionView()
        
    }
    
    override func loadContent() {
        
    }
}


extension CMDBMovieStaffGroupCell{

    private func setupCollectionView(){
        
        let collectionViewH = CGFloat(42 * 2 + 100 * 2 + 88)
        
        let collectionFrame = CGRect(x: 0, y: CGRectGetMaxY(titleLabel.frame), width: CMDB_Screen_Width, height: collectionViewH)
        
        staffCollectionView = CMDBMovieStaffCollectionView.getInstance()
        
        staffCollectionView.mDelegate = self
        
        staffCollectionView.frame = collectionFrame
        
        contentView.addSubview(staffCollectionView)
        
    }
}


extension CMDBMovieStaffGroupCell{
    
    override func onItemClickType(itemClickType: String?, data: AnyObject?, indexPath: NSIndexPath?) {
        mDelegate?.onItemClickType!(itemClickType, data: "ssssss", indexPath: nil)
    }
    
}
